<link rel="stylesheet" type="text/css" href="css/accourt.css"/>
<link rel="stylesheet" href="css/trecord.css" media="all" />
<link rel="stylesheet" href="css/page.css" media="all" />
<script type="text/javascript" src="js/Calendar.js"></script>
<script type="text/javascript" src="js/global/Date_func.js"></script>
<style>

.acctab td.tL{ text-align:left; padding-left:10px;}
.dname{height:18px; width:200px;}
.accountsearch{color:white;text-decoration:none;}
font-size: 1.4em;background-color: #00a0e9;text-align: center;font-weight: normal;color: #FFF;cursor: pointer;}
#excel{color:#fff;}
 #special_w{width:1200px}
 #spe_w{width:900px;}
</style>
<div class="r_content" id="spe_w">
	<h3 class="mc_title pageblock">
		<span class="mctit_1"><span class="mctit_2">会员交易记录</span></span>
        <?if($_SESSION['memberID']==23444&&$_SESSION['sdtype']==9&&$_SESSION['sid']==1||$_SESSION['memberID']==24445||$_SESSION['memberID']==23441):?>
        <span class="mctit_1 mctit_3"><a href="accountSearch.html" class="mctit_2 mctit_4">账户余额查询</a></span>
        
        <span class="mctit_1 mctit_3"><a href="trecordCount.html" class="mctit_2 mctit_4">交易记录统计</a></span>
        <?endif;?>
	</h3>
	<div class="accoinfo accos">
		<form id="searchBox">
			<input type="hidden" name="act" id="act" />
			<input type="hidden" name="timeT" id="timeT" value=""/>
			<input type="hidden" name="dtype" id="dtype" value="<?=$_REQUEST['dtype']?>"/>
			<input type="hidden" name="daction" id="daction" value="<?=$_REQUEST['daction']?>"/>
			<input type="hidden" name="about" id="about" value="<?=$about?>"/>
			<input type="hidden" name="account" id="account" value="<?=$_REQUEST['account']?>"/>
			<ul class="search">
				<li class="time">
					<span>分销商：</span>
					<input type="text" class="dname w437" name="dname" value="<?=$_REQUEST['dname']?>" placeholder="id/帐号/手机号/企业名称"/>
                    <input class="iCheck" value="1" name='no_test' type="checkbox" <?if($_GET['no_test']) echo 'checked=true';?>>
                    过滤测试帐号
                    </input>
				
				</li>
				<li class="time">
					<span>起止日期：</span>
					<input type="text" name="beginDate" id="begintime" onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)" value="<?=$_REQUEST['beginDate']?>"/>
					<label>至</label>
					<input type="text" name="endDate"  id="endtime" onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)" value="<?=$_REQUEST['endDate']?>"/>
					<a title="today" class="<?=$_REQUEST['timeT']=="today"?"current":""?>">今天</a>
					<a title="yesterday" class="<?=$_REQUEST['timeT']=="yesterday"?"current":""?>">昨天</a>
					<a title="week" class="<?=$_REQUEST['timeT']=="week"?"current":""?>">本周</a>
					<a title="lastweek" class="<?=$_REQUEST['timeT']=="lastweek"?"current":""?>">上周</a>
					<a title="month" class="<?=$_REQUEST['timeT']=="month"?"current":""?>">本月</a>
					<a title="lastmonth" class="<?=$_REQUEST['timeT']=="lastmonth"?"current":""?>">上月</a>
					
				</li>
                 <li class="skey">
                  <span >订单号：</span >
                  <input class="w437" name='orderid' value="<?=$_GET['orderid']?>"/>

                </li>
				<li class="skey">
					<span>交易类型：</span>
					<a class="<?=!isset($_REQUEST['dtype'])||($_REQUEST['dtype']==="")?"current":""?>" key="dtype" kvalue="">全部</a>
					<a class="<?=$_REQUEST['dtype']==='0'?"current":""?>" key="dtype" kvalue="0">下单</a>
					<a class="<?=$_REQUEST['dtype']==='1'?"current":""?>" key="dtype" kvalue="1">撤改</a>
					<a class="<?=$_REQUEST['dtype']==='3'?"current":""?>" key="dtype" kvalue="3">充值</a>
					<a class="<?=$_REQUEST['dtype']==='4'?"current":""?>" key="dtype" kvalue="4">授信/预存</a>
					<a class="<?=$_REQUEST['dtype']==='5'?"current":""?>" key="dtype" kvalue="5">分润</a>
					<a class="<?=$_REQUEST['dtype']==='6'?"current":""?>" key="dtype" kvalue="6">提现冻结</a>
                    <a class="<?=$_REQUEST['dtype']==='7'?"current":""?>" key="dtype" kvalue="7">服务费</a>
                    <a class="<?=$_REQUEST['dtype']==='16'?"current":""?>" key="dtype" kvalue="16">充值返现</a>
				</li>
                <?/*
				<li class="skey">
					<span>运营支付：</span>
					<a class="<?=!isset($_REQUEST['dtype'])||($_REQUEST['dtype']==="")?"current":""?>" key="dtype" kvalue="">全部</a>
					<a class="<?=$_REQUEST['dtype']==='7'?"current":""?>" key="dtype" kvalue="7">电子凭证费</a>
					<a class="<?=$_REQUEST['dtype']==='8'?"current":""?>" key="dtype" kvalue="8">短信费</a>
					<a class="<?=$_REQUEST['dtype']==='9'?"current":""?>" key="dtype" kvalue="9">交易手续费</a>
				</li>
                */?>
				<li class="skey">
<!--					<span >收支情况：</span>-->
<!--					<a class="--><?//=!isset($_REQUEST['daction'])||($_REQUEST['daction']==="")?"current":""?><!--" key="daction" kvalue="">全部</a>-->
<!--					<a class="--><?//=$_REQUEST['daction']==='0'?"current":""?><!--" key="daction" kvalue="0">收入</a>-->
<!--					<a class="--><?//=$_REQUEST['daction']=='1'?"current":""?><!--" key="daction" kvalue="1">支出</a>-->
<!--					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
					<span >账户类型：</span>
					<a class="<?=($_REQUEST['account']==="alipay" )?"current":""?>" key="account" kvalue="alipay">在线支付</a>
					<a class="<?=!isset($_REQUEST['account'])||$_REQUEST['account']=='pft' || $_REQUEST['account']==''?"current":""?>" key="account" kvalue="pft">平台账户</a>
					<a class="<?=$_REQUEST['account']=='credit'?"current":""?>" key="account" kvalue="credit">授信账户</a>
					<a class="<?=$_REQUEST['account']=='creditSet'?"current":""?>" key="account" kvalue="creditSet">授信设置</a>

                    <a class="<?=$_REQUEST['account']=='tenpay'?"current":""?>" key="account" kvalue="tenpay">在线收入</a>
<!--                    <a class="--><?//=$_REQUEST['account']=='unipay'?"current":""?><!--" key="account" kvalue="unipay">银联</a>-->
<!--                    <a class="--><?//=$_REQUEST['account']=='ips_pay'?"current":""?><!--" key="account" kvalue="ips_pay">环迅</a>-->
                   
                </li>	
               
                 <li class="skey">
                    <input type="submit" id="query" value="查询"/>
                	<a href="javascript:void(0);" id="excel" class="axport" >导出Excel</a>
				</li>	
			</ul>
		</form>
	</div>
	<div class="acclist">
		<table class="acctab">
			<thead>
				<tr>
					<th class="tL">交易商户</th>
                    <th>订单号</th>
					<th class="tL">交易时间</th>
					<th>交易号</th>                    
					<th>交易内容</th>
					<th>交易方式</th>
					<th class="tR">收入</th>
					<th class="tR">支出</th>
					<th class="tR">账户余额</th>
					<th class="tR">授信余额</th>
					<th class="tR">供应关系</th>
                    <?if($_REQUEST['dtype']&&$_REQUEST['dtype']==3&&$_REQUEST['account']&&$_REQUEST['account']=="pft"){?>
                        <th class="tR">操作员</th>
                    <?}?>
					<th class="tR">备注</th>
				</tr>
			 </thead>
			  <tbody id="tbody">
                <?if($r[0]!=""){?>
				<?
                    $ptype_arr = array(0,1,4,5,6);
                    foreach($r as $row){$i++;
                ?>
				<tr class="<?=($i%2==1)?"odd":"even"?>">
					<td class="tL">
                    <?foreach($ainfo as $dinfo){
                        if($dinfo['id']==$row['fid']){
                    ?>
                    <span style="color:red">ID:<?=$dinfo['id']?> </span><br/><?=$dinfo['dname']?>
                    <?break;}}?>
                    </td>
                    <td><a href="http://www.12301.cc/orderView.html?from=sale&ordernum=<?=$row['orderid']?>&type=A&aid=<?=$row['fid']?>"  target="_blank"><?=$row['orderid'].$row['UUstatus']?></a></td>
                    <td title="<?=$row['id']?>"><?=$row['rectime']?></td>
					<td><?=$row['trade_no']?></td>
					<td><?=$dtypeT[$row['dtype']]?$dtypeT[$row['dtype']]:$row['dtypeT']?></td>
                    <td><?=$ptypeT[$row['ptype']];?></td>
					<td class="income tR"><?=$row['income']?></td>
					<td class="tR"><?=$row['pay']?></td>
                    <td class="lmoney tR"><?=in_array($row['ptype'],$ptype_arr)?$row['lmoney']/100:""?></td>
					<td class="lmoney tR"><?=($row['ptype']==2||$row['ptype']==3)?$row['lmoney']/100:""?></td>
					<td class="lmoney tR">
                        <a href="javascript:;" class="show_order_relation" data-order="<?=$row['orderid']?>">查看</a>
                    </td>
                    <?if($_REQUEST['dtype']&&$_REQUEST['dtype']==3&&$_REQUEST['account']&&$_REQUEST['account']=="pft"){?>
                        <td class="lmoney tR"><?=$row['operator']?></td>
                    <?}?>
					<td class="lmoney tR">
                        <?=$row['memo']?>
                    </td>
				</tr>
				<?}}?>
				<?if(count($r)==0&&$_REQUEST['account']!='all'){?>
					<tr><td colspan="8" style="text-align:left; padding-left:60px;">无资金流向记录</td></tr>
				<?}elseif(count($r)==1&&$r[0]==""&&$_REQUEST['account']=='all'){?>
                    <tr><td colspan="8" style="text-align:left; padding-left:60px;">请输入筛选条件</td></tr>
                <?}?>
			</tbody>
		</table>
		<?if(count($r)!=0){page($count,$currentPage,$pageSize);}?>
	</div>
</div>
<script>
    $(document).ready(function(){
        $("#tbody").on('click','a.show_order_relation', function(){
//            alert($(this).data('order'))
            var td = $(this).parent();
            $.getJSON('call/jh_prod.php',{action:'OrderRelationShip',ordernum:$(this).data('order')})
                    .done(function(json){
                        if (json.status=='ok') {
                            td.html(json.ret);
                        } else {
                            alert(json.msg);
                        }
                    })
        });
        $(".mc_1").click(function(){
            window.location="accountSearch.html";
        });
    });
	$(".search li.time a").click(function(){
		var title=$(this).attr("title");
		Date_func.selectDate(title,document.getElementById("begintime"),document.getElementById("endtime"));
		$("#timeT").val(title)
		$("#searchBox").submit();
	})
	$(".search li.skey a").click(function(){
		var key=$(this).attr("key");
		$("#"+key).val($(this).attr("kvalue"));
		$("#searchBox").submit();
	})
	$("#excel").click(function(){
		$("#act").val("Export");
		$("form#searchBox").submit();
		$("#act").val("");
	});

</script>